home *** CD-ROM | disk | FTP | other *** search
/ Final Fantasy the Spirits Within Cardz / Final Fantasy the Spirits Within CD Cardz - Disc 1: Aki Ross.iso / pc / assets / aki-puzzle.dcr / 00060_button behaviour.ls < prev    next >
Encoding:
Text File  |  2001-07-21  |  10.4 KB  |  374 lines

  1. property my, IncrementValue, HomePosX, HomePosY, friction, ratio, dragging, speedX, speedY, Engaged01, Engaged02, Disengaged01, Disengaged02, castLibrary
  2. global whoIsOccupying
  3.  
  4. on beginSprite me
  5.   Initialize(me)
  6. end
  7.  
  8. on Initialize me
  9.   my = me.spriteNum
  10.   sprite(my).moveableSprite = 1
  11.   if my = 151 then
  12.     HomePosX = 60
  13.     HomePosY = 24
  14.   else
  15.     if my = 152 then
  16.       HomePosX = 100
  17.       HomePosY = 24
  18.     else
  19.       if my = 153 then
  20.         HomePosX = 140
  21.         HomePosY = 24
  22.       else
  23.         if my = 154 then
  24.           HomePosX = 180
  25.           HomePosY = 24
  26.         else
  27.           if my = 155 then
  28.             HomePosX = 220
  29.             HomePosY = 24
  30.           else
  31.             if my = 156 then
  32.               HomePosX = 260
  33.               HomePosY = 24
  34.             end if
  35.           end if
  36.         end if
  37.       end if
  38.     end if
  39.   end if
  40.   friction = 0.69999999999999996
  41.   ratio = 0.29999999999999999
  42.   dragging = 0
  43.   speedX = 0
  44.   speedY = 0
  45.   castLibrary = castLib("Shared").number
  46.   if whoIsOccupying <> 0 then
  47.     set the locH of sprite whoIsOccupying to 526
  48.     set the locV of sprite whoIsOccupying to 19
  49.     set the blend of sprite whoIsOccupying to 0
  50.     puppetSprite(150, 1)
  51.     set the ink of sprite 150 to 36
  52.     sprite(150).member = member(8, castLibrary)
  53.     set the locH of sprite 150 to the locH of sprite whoIsOccupying
  54.     set the locV of sprite 150 to the locV of sprite whoIsOccupying
  55.   end if
  56. end
  57.  
  58. on exitFrame me
  59.   update(me)
  60. end
  61.  
  62. on update me
  63.   if whoIsOccupying <> my then
  64.     if dragging = 0 then
  65.       speedX = (speedX * friction) + ((HomePosX - sprite(my).locH) * ratio)
  66.       speedY = (speedY * friction) + ((HomePosY - sprite(my).locV) * ratio)
  67.       sprite(my).locH = sprite(my).locH + speedX
  68.       sprite(my).locV = sprite(my).locV + speedY
  69.     end if
  70.   end if
  71. end
  72.  
  73. on mouseEnter me
  74.   if my = 151 then
  75.     sprite(141).visible = 1
  76.   else
  77.     if my = 152 then
  78.       sprite(142).visible = 1
  79.     else
  80.       if my = 153 then
  81.         sprite(143).visible = 1
  82.       else
  83.         if my = 154 then
  84.           sprite(144).visible = 1
  85.         else
  86.           if my = 155 then
  87.             sprite(145).visible = 1
  88.           else
  89.             if my = 156 then
  90.               sprite(146).visible = 1
  91.             end if
  92.           end if
  93.         end if
  94.       end if
  95.     end if
  96.   end if
  97.   cursor(280)
  98. end
  99.  
  100. on mouseLeave me
  101.   if my = 151 then
  102.     sprite(141).visible = 0
  103.   else
  104.     if my = 152 then
  105.       sprite(142).visible = 0
  106.     else
  107.       if my = 153 then
  108.         sprite(143).visible = 0
  109.       else
  110.         if my = 154 then
  111.           sprite(144).visible = 0
  112.         else
  113.           if my = 155 then
  114.             sprite(145).visible = 0
  115.           else
  116.             if my = 156 then
  117.               sprite(146).visible = 0
  118.             end if
  119.           end if
  120.         end if
  121.       end if
  122.     end if
  123.   end if
  124.   cursor(-1)
  125. end
  126.  
  127. on mouseDown me
  128.   dragging = 1
  129.   repeat while the stillDown
  130.     sprite(my).locH = the mouseH
  131.     sprite(my).locV = the mouseV
  132.     sprite(my).blend = 100
  133.     if whoIsOccupying = my then
  134.       sprite(150).visible = 0
  135.     end if
  136.     updateStage()
  137.   end repeat
  138.   if whoIsOccupying = my then
  139.     if inside(point(the mouseH, the mouseV), the rect of sprite 140) then
  140.       sprite(150).visible = 1
  141.       sprite(my).blend = 0
  142.     end if
  143.   end if
  144. end
  145.  
  146. on mouseUp me
  147.   if whoIsOccupying = my then
  148.     if inside(point(the mouseH, the mouseV), the rect of sprite 140) = 0 then
  149.       if my = 151 then
  150.         Disengaged01 = "TrailerDisengaged01"
  151.         Disengaged02 = "TrailerDisengaged02"
  152.         disengagedWarning(me)
  153.       else
  154.         if my = 152 then
  155.           Disengaged01 = "ProfileDisengaged01"
  156.           Disengaged02 = "ProfileDisengaged02"
  157.           disengagedWarning(me)
  158.         else
  159.           if my = 153 then
  160.             Disengaged01 = "PhotoDisengaged01"
  161.             Disengaged02 = "PhotoDisengaged02"
  162.             disengagedWarning(me)
  163.           else
  164.             if my = 154 then
  165.               Disengaged01 = "SoundtrackDisengaged01"
  166.               Disengaged02 = "SoundtrackDisengaged02"
  167.               disengagedWarning(me)
  168.             else
  169.               if my = 155 then
  170.                 Disengaged01 = "PuzzleDisengaged01"
  171.                 Disengaged02 = "PuzzleDisengaged02"
  172.                 disengagedWarning(me)
  173.               else
  174.                 if my = 156 then
  175.                   Disengaged01 = "VGDisengaged01"
  176.                   Disengaged02 = "VGDisengaged02"
  177.                   disengagedWarning(me)
  178.                 end if
  179.               end if
  180.             end if
  181.           end if
  182.         end if
  183.       end if
  184.       whoIsOccupying = 0
  185.       dragging = 0
  186.     end if
  187.   else
  188.     if whoIsOccupying = 0 then
  189.       if inside(point(the mouseH, the mouseV), the rect of sprite 140) then
  190.         sprite(my).locH = 526
  191.         sprite(my).locV = 19
  192.         updateStage()
  193.         sprite(my).blend = 0
  194.         sprite(150).visible = 1
  195.         puppetSprite(150, 1)
  196.         set the ink of sprite 150 to 36
  197.         sprite(150).member = member(1, castLibrary)
  198.         set the locH of sprite 150 to sprite(my).locH
  199.         set the locV of sprite 150 to sprite(my).locV
  200.         startTimer()
  201.         repeat while the timer < 5
  202.           updateStage()
  203.         end repeat
  204.         puppetSprite(150, 1)
  205.         set the ink of sprite 150 to 36
  206.         sprite(150).member = member(2, castLibrary)
  207.         set the locH of sprite 150 to sprite(my).locH
  208.         set the locV of sprite 150 to sprite(my).locV
  209.         startTimer()
  210.         repeat while the timer < 5
  211.           updateStage()
  212.         end repeat
  213.         puppetSprite(150, 1)
  214.         set the ink of sprite 150 to 36
  215.         sprite(150).member = member(3, castLibrary)
  216.         set the locH of sprite 150 to sprite(my).locH
  217.         set the locV of sprite 150 to sprite(my).locV
  218.         startTimer()
  219.         repeat while the timer < 5
  220.           updateStage()
  221.         end repeat
  222.         puppetSprite(150, 1)
  223.         set the ink of sprite 150 to 36
  224.         sprite(150).member = member(4, castLibrary)
  225.         set the locH of sprite 150 to sprite(my).locH
  226.         set the locV of sprite 150 to sprite(my).locV
  227.         startTimer()
  228.         repeat while the timer < 5
  229.           updateStage()
  230.         end repeat
  231.         puppetSprite(150, 1)
  232.         set the ink of sprite 150 to 36
  233.         sprite(150).member = member(5, castLibrary)
  234.         set the locH of sprite 150 to sprite(my).locH
  235.         set the locV of sprite 150 to sprite(my).locV
  236.         startTimer()
  237.         repeat while the timer < 5
  238.           updateStage()
  239.         end repeat
  240.         puppetSprite(150, 1)
  241.         set the ink of sprite 150 to 36
  242.         sprite(150).member = member(6, castLibrary)
  243.         set the locH of sprite 150 to sprite(my).locH
  244.         set the locV of sprite 150 to sprite(my).locV
  245.         startTimer()
  246.         repeat while the timer < 5
  247.           updateStage()
  248.         end repeat
  249.         puppetSprite(150, 1)
  250.         set the ink of sprite 150 to 36
  251.         sprite(150).member = member(7, castLibrary)
  252.         set the locH of sprite 150 to sprite(my).locH
  253.         set the locV of sprite 150 to sprite(my).locV
  254.         startTimer()
  255.         repeat while the timer < 5
  256.           updateStage()
  257.         end repeat
  258.         puppetSprite(150, 1)
  259.         set the ink of sprite 150 to 36
  260.         sprite(150).member = member(8, castLibrary)
  261.         set the locH of sprite 150 to sprite(my).locH
  262.         set the locV of sprite 150 to sprite(my).locV
  263.         startTimer()
  264.         repeat while the timer < 5
  265.           updateStage()
  266.         end repeat
  267.         whoIsOccupying = my
  268.         if my = 151 then
  269.           Engaged01 = "TrailerEngaged01"
  270.           Engaged02 = "TrailerEngaged02"
  271.           engagedWarning(me)
  272.           play movie "Aki-Main"
  273.         else
  274.           if my = 152 then
  275.             Engaged01 = "ProfileEngaged01"
  276.             Engaged02 = "ProfileEngaged02"
  277.             engagedWarning(me)
  278.             play movie "Aki-Profile"
  279.           else
  280.             if my = 153 then
  281.               Engaged01 = "PhotoEngaged01"
  282.               Engaged02 = "PhotoEngaged02"
  283.               engagedWarning(me)
  284.               play movie "Aki-Photogallery"
  285.             else
  286.               if my = 154 then
  287.                 Engaged01 = "SoundtrackEngaged01"
  288.                 Engaged02 = "SoundtrackEngaged02"
  289.                 engagedWarning(me)
  290.                 play movie "Aki-Soundtrack"
  291.               else
  292.                 if my = 155 then
  293.                   Engaged01 = "PuzzleEngaged01"
  294.                   Engaged02 = "PuzzleEngaged02"
  295.                   engagedWarning(me)
  296.                   play movie "Aki-Puzzle"
  297.                 else
  298.                   if my = 156 then
  299.                     Engaged01 = "VGEngaged01"
  300.                     Engaged02 = "VGEngaged02"
  301.                     engagedWarning(me)
  302.                     play movie "Aki-Vehicles&Gear"
  303.                   end if
  304.                 end if
  305.               end if
  306.             end if
  307.           end if
  308.         end if
  309.       else
  310.         dragging = 0
  311.         sprite(my).blend = 100
  312.       end if
  313.     else
  314.       dragging = 0
  315.       sprite(my).blend = 100
  316.     end if
  317.   end if
  318. end
  319.  
  320. on engagedWarning me
  321.   sprite(25).visible = 1
  322.   puppetSound(1, "engager")
  323.   i = 1
  324.   repeat while i < 5
  325.     set the locH of sprite 24 to -500
  326.     puppetSprite(170, 1)
  327.     set the memberNum of sprite 170 to the number of member Engaged01 of castLib "Shared"
  328.     set the ink of sprite 170 to 36
  329.     set the loc of sprite 170 to point(400, 240)
  330.     startTimer()
  331.     repeat while the timer < 15
  332.       updateStage()
  333.     end repeat
  334.     puppetSprite(170, 1)
  335.     sprite(150).member = member(8, castLibrary)
  336.     set the memberNum of sprite 170 to the number of member Engaged02 of castLib "Shared"
  337.     set the ink of sprite 170 to 36
  338.     set the loc of sprite 170 to point(400, 240)
  339.     startTimer()
  340.     repeat while the timer < 15
  341.       updateStage()
  342.     end repeat
  343.     i = i + 1
  344.   end repeat
  345.   puppetSprite(170, 0)
  346. end
  347.  
  348. on disengagedWarning me
  349.   sprite(25).visible = 1
  350.   set the locH of sprite 24 to -500
  351.   puppetSound(1, "engager")
  352.   i = 1
  353.   repeat while i < 5
  354.     puppetSprite(170, 1)
  355.     set the memberNum of sprite 170 to the number of member Disengaged01 of castLib "Shared"
  356.     set the ink of sprite 170 to 36
  357.     set the loc of sprite 170 to point(400, 240)
  358.     startTimer()
  359.     repeat while the timer < 15
  360.       updateStage()
  361.     end repeat
  362.     puppetSprite(170, 1)
  363.     set the memberNum of sprite 170 to the number of member Disengaged02 of castLib "Shared"
  364.     set the ink of sprite 170 to 36
  365.     set the loc of sprite 170 to point(400, 240)
  366.     startTimer()
  367.     repeat while the timer < 15
  368.       updateStage()
  369.     end repeat
  370.     i = i + 1
  371.   end repeat
  372.   puppetSprite(170, 0)
  373. end
  374.